package edu.put.sk.nrpp.ui;

import java.awt.*;

import javax.swing.JComponent;

import edu.put.sk.nrpp.ConnectionList;

public class PaintConnections extends JComponent{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ConnectionList _connectionList;
	public PaintConnections(ConnectionList connectionList){
		super();
		this._connectionList=connectionList; 
		}

	@Override
	public void paint(Graphics g){
		super.paint(g);
		Graphics2D g2= (Graphics2D) g;
	    //g2.drawString ("The CustomCanvas is in the CENTER area", 10, 100);
		//l.drawRect(0, 0, 1000, 1000);
		//l.setColor(new Color(0, 0, 255));
	    for (GraphicsConnection gc: _connectionList.graphicsConnections){
	    	g2.drawLine(gc.posXR1, gc.posYR1, gc.posXR2, gc.posYR2);
	    }
		
	}
	
	public void changeSize(int sizeX, int sizeY){
		setSize(sizeX, sizeY);
	}
	
	/*
	 * public void paint(Graphics win) {
		int ovalDia;
		int r, g, b;
		int x, y;
		
		// set the height and width of this canvas
		// this depends on where it is added, so we'll use
		// getSize to get its dimensions
		h = getSize().height;
		w = getSize().width;
		win.drawRect(0,0, w-1, h-1);	// Draw border
		
		// draw a random colored oval
		ovalDia = (int) (Math.random()*(w/4));
		x = (int) (Math.random()*w);
		y = (int) (Math.random()*h);
		
		r = (int) (Math.random()*256);
		g = (int) (Math.random()*256);
		b = (int) (Math.random()*256);
		
		win.setColor(new Color(r, g, b));
		win.fillOval(x, y, ovalDia, ovalDia);
		
	} // paint
	 */
	
}
